home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6978 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.softcon.de!usenet
  2. From: us@SoftcoN.de (Uwe Steffen)
  3. Newsgroups: comp.databases.oracle,comp.lang.c++
  4. Subject: Re: Pro*C DB access routines with C++
  5. Date: 21 Feb 1996 13:09:33 GMT
  6. Organization: SOFTCON Gesellschaft fuer Systementwicklung mbH, Oberhaching, Muenchen, Deutschland
  7. Sender: us@hp4kiss.SoftcoN.de (Uwe Steffen)
  8. Message-ID: <4gf5id$jec@boell.softcon.de>
  9. References: <4g6vjv$gvv@news1.halcyon.com> <4gcf0c$e02@relay2.uk.mdis.com>
  10. NNTP-Posting-Host: hp4kiss.softcon.de
  11. X-Newsreader: knews 0.9.2
  12. In-Reply-To: <4gcf0c$e02@relay2.uk.mdis.com>
  13. To: danubius@coho.halcyon.com
  14.  
  15. In article <4gcf0c$e02@relay2.uk.mdis.com>,
  16.     100610.52@compuserve.com (Balakrishna Avula) writes:
  17. >danubius@coho.halcyon.com () wrote:
  18. >
  19. >>I've been trying to find a book covering this subject to no avail so
  20. >>far.  
  21. >
  22. >>I have a C++ project that will need a bunch of Pro*C ORACLE DB access
  23. >>routines.  I'd like to wrap these routines in C++ classes, but being
  24. >>fairly new at both, I could use some help from published books on this
  25. >>subject, or example source code.
  26.  
  27. Hi,
  28. it's a little bit tricky to start with, however solvable.
  29. 1) You have to use PRO*C 1.6 instead of PRO*C 2.*, because
  30.    PRO*C 1.6 does not scan the entire file, only statements that
  31.    start with 'EXEC SQL'.
  32. 2) our .ec-files are called '*.ec', so we use the following rule to create
  33.    object-files:
  34.    .ec.o:
  35.        $(ESQL) INAME=$*.ec ONAME=$*.c $(ESQLFLAGS)
  36.        sed -f ../changec_C.sed $*.c >$*.C
  37.        $(RM) $*.EC
  38.        $(RM) $*.c
  39.        $(CC) -c $(FLAGS) $*.C
  40.    The sed-scripts does some postprocessing to correct
  41.    some incompatibilitys.
  42.    changec_C.sed:
  43. 1,$s/char  filnam\[.*\]/char  filnam\[31\]/
  44. /extern sqlcex(*/d
  45. /extern sqlora(*/d
  46. /extern sqlbuf(*/d
  47. /extern sqlcte(*/d
  48. /extern sqlcx2(*/d
  49. /extern    sqliem(*/d
  50.    You will have to put extern "C" { ... } -wrappers around function-
  51.    prototypes in oracle-headerfiles.
  52.  
  53. Good luck
  54. Uwe Steffen
  55.  
  56.  
  57.  
  58.